package com.sky.service.impl;


import com.sky.service.ShopService;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;

@Service
public class ShopServiceImpl implements ShopService {
    @Autowired
    private RedisTemplate<String, String> redisTemplate;
    private ValueOperations<String,String> valueOperations;


    public void setStatus(Integer Status){
        valueOperations = redisTemplate.opsForValue();
        if (Status == 1){
            valueOperations.set("shop_status","1");
        } else if (Status == 0) {
            valueOperations.set("shop_status","0");
        }
    }

    @Override
    public Integer getStatus() {
        valueOperations = redisTemplate.opsForValue();
       return Integer.parseInt(valueOperations.get("shop_status"));
    }
}
